package com.ruoyi.api.controller;

import com.ruoyi.api.domain.GuidEntity;
import com.ruoyi.api.domain.ScenicEntity;
import com.ruoyi.api.domain.ScenicTypeEntity;
import com.ruoyi.api.service.ScenicService;
import com.ruoyi.api.service.ScenicTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ScenicController {

    @Autowired
    private MongoTemplate mongoTemplate;


    @Autowired
    private ScenicService scenicService;

    @Autowired
    private ScenicTypeService scenicTypeService;
    /**
     * 列表
     *
     * @param loginBody 登录信息
     * @return 结果
     */
    @GetMapping("/front/scenicList")
    public Page<ScenicEntity> guidList(ScenicEntity loginBody, @RequestParam(required = true,name = "page") int page, @RequestParam(required = true,name = "size") int size) throws IllegalAccessException {
        Page<ScenicEntity> entities = scenicService.selectList(ScenicEntity.class,loginBody,page,size,mongoTemplate);
        return entities;
    }

    /**
     * 列表
     *
     * @param loginBody 登录信息
     * @return 结果
     */
    @GetMapping("/front/scenicTypeList")
    public Page<ScenicTypeEntity> scenicTypeList(ScenicTypeEntity loginBody, @RequestParam(required = true,name = "page") int page, @RequestParam(required = true,name = "size") int size) throws IllegalAccessException {
        Page<ScenicTypeEntity> entities = scenicTypeService.selectList(ScenicTypeEntity.class,loginBody,page,size,mongoTemplate);
        return entities;
    }
}
